package org.openzip.openzip.gui.util;

import java.io.File;
import java.util.ArrayList;
import java.util.jar.JarEntry;

public class MyJarFile extends File {

	private ArrayList<MyJarFile> arr = new ArrayList<MyJarFile>();
	private JarEntry jarEntry;

	public MyJarFile(JarEntry jarEntry) {
		super(jarEntry == null ? "\\" : jarEntry.getName());
		this.jarEntry = jarEntry;
	}

	public File[] listFiles() {
		File[] f = new File[arr.size()];
		return arr.toArray(f);
	}

	public boolean isFile() {
		return !jarEntry.isDirectory();
	}

	public boolean isDirectory() {
		return jarEntry.isDirectory();
	}

	public void addJarFile(MyJarFile jarFile) {
		arr.add(jarFile);
	}

	public String getEntryPath() {
		return jarEntry == null ? "\\" : jarEntry.getName();
	}

}
